package com.gsi.multichannel.sf.pipelet;

import java.util.ArrayList;
import java.util.Iterator;

import com.intershop.beehive.core.capi.naming.NamingMgr;
import com.intershop.beehive.core.capi.pipeline.Pipelet;
import com.intershop.beehive.core.capi.pipeline.PipelineDictionary;
import com.training.capi.BoxManager;
import com.training.internal.BoxPO;

/**
 * 
 */
public class ShowBoxes extends Pipelet
{
    public static final String DN_BOXES = "boxes";
    private BoxManager manager;

    public int execute(PipelineDictionary dict)
    {
        //ArrayList<String>list = new ArrayList<String>();
        manager = (BoxManager)NamingMgr.getInstance().lookupManager(BoxManager.REGISTRY_NAME);
        //Iterator <BoxPO> it = (Iterator<BoxPO>)manager.retrieveBox().iterator();
//        while (it.hasNext()) {
//            BoxPO box = it.next();
//            String message = "NAME: [" + box.getName() + "]   UUID: [" + box.getUUID() + "]   DomainID: [" + box.getDomainID() + "]   OCA: [" + box.getOca() + "]";
//            list.add(message);
//        }
        dict.put(DN_BOXES, manager.retrieveBox());
        return PIPELET_NEXT;
    }
}